Skip to main content

close file

Type

command

Summary

Closes a file that was opened with the open file command.

Syntax

close file <filePath>

Description

Use the close file command to release a file after reading from it or writing to it. (A file that is open for writing can't be used by any other application until you've closed the file.)

Any files you have opened are closed automatically when you quit the application. printer:(keyword), COMn: (keyword), LPT1: (keyword), serialControlString (property)

Parameters

NameTypeDescription

filePath

The name and location of the file you want to close. If you specify a name but not a location, LiveCode assumes the file is in the defaultFolder.

Examples

close file "/Desktop/Temp"
close file line 1 of the openFiles
open file (specialFolderPath("desktop") & "/text.txt")
write "This is a test" \
to file (specialFolderPath("desktop") & "/text.txt" )
close file (specialFolderPath("desktop") & "/text.txt")

glossary: command

keyword: file, modem:

command: write to file, close driver, open file, close, seek, read from file, delete file

function: openFiles, sysError

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?